<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改顶岗实习信息')"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-role-edit" th:object="${work}">
        <input id="workId" name="workId" th:field="*{workId}" type="hidden"/>
        <div class="form-group">
            <label class="col-sm-3 control-label ">名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="productionName" name="productionName" required th:field="*{workName}"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">申请要求：</label>
            <div class="col-sm-8">
                <textarea class="form-control" id="workRequire" name="workRequire" required th:field="*{workRequire}"
                          type="text"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">申请截至时间：</label>
            <div class="col-sm-8">
                <input class="form-control" id="workOver" name="workOver" placeholder="年-月-日" required th:field="*{workOver}"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">作业数量：</label>
            <div class="col-sm-8">
                <input class="form-control" id="workWeeks" name="workWeeks" required th:field="*{workWeeks}"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">作业填写要求：</label>
            <div class="col-sm-8">
                <textarea class="form-control" id="workWeekly" name="workWeekly" required th:field="*{workWeekly}"
                          type="text"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">作业开始时间：</label>
            <div class="col-sm-8">
                <input class="form-control" id="workBegin" name="workBegin" placeholder="年-月-日" required th:field="*{workBegin}"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">作业结束时间：</label>
            <div class="col-sm-8">
                <input class="form-control" id="workEnd" name="workEnd" placeholder="年-月-日" required th:field="*{workEnd}"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">作业成绩占比(%)：</label>
            <div class="col-sm-8">
                <input class="form-control" id="pacific" name="pacific" required th:field="*{pacific}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">总结成绩占比(%)：</label>
            <div class="col-sm-8">
                <input class="form-control" id="exam" name="exam" required th:field="*{exam}" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<script type="text/javascript">
    $(function () {
        $("#workOver").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $("#workBegin").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $("#workEnd").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    });

    function edit() {
        var workId = $("input[name='workId']").val();
        var workName = $("input[name='workName']").val();
        var workRequire = $("textarea[name='workRequire']").val();
        var workOver = $("input[name='workOver']").val();
        var workWeeks = $("input[name='workWeeks']").val();
        var workWeekly = $("textarea[name='workWeekly']").val();
        var workBegin = $("input[name='workBegin']").val();
        var workEnd = $("input[name='workEnd']").val();
        var pacific = $("input[name='pacific']").val();
        var exam = $("input[name='exam']").val();
        $.ajax({
            cache: true,
            type: "POST",
            url: ctx + "sau/work/updateWork",
            data: {
                "workId": workId,
                "workName": workName,
                "workRequire": workRequire,
                "workOver": workOver,
                "workWeeks": workWeeks,
                "workWeekly": workWeekly,
                "workBegin": workBegin,
                "workEnd": workEnd,
                "pacific": pacific,
                "exam": exam
            },
            async: false,
            error: function (request) {
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                $.operate.successCallback(data);
            }
        });
    }

    function submitHandler() {
        if ($.validate.form()) {
            edit();
        }
    }
</script>
</body>
</html>
